<%@ page import="java.util.Date" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>资金管理</title>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">
    <%@include file="../include/commonFile.jsp" %>
</head>
<body>

<!--头部-->
<%@include file="../include/header.jsp" %>
<div class="index-outside">
    <%@include file="../include/sidebar.jsp" %>
    <!--内容-->
    <section>
        <div class="section-main">
            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                <ul class="layui-tab-title">
                    <li><span class="title f18 ml5 mr5">全部资金</span></li>
                    <li class="layui-this"><span class="title f18 ml5 mr5">众筹资金</span></li>
                    <%--<li><span class="title f18 ml5 mr5">活动资金</span></li>--%>
                </ul>
                <div class="member-index-top mt20">
                    <div class="top-left">
                        <div style="flex: 1;">
                            <div class="display-flex">
                                <div class="info-div" style="font-size:20px;display:inline">
                                    <span>&nbsp;&nbsp;&nbsp;众筹累计资金： </span>
                                    <span><b class="active-red">
                                        <c:if test="${orderTotal > 0}">
							              <fmt:formatNumber pattern="#,###.##" value="${orderTotal}"/>
						                </c:if>
				                    	<c:if test="${orderTotal == 0.0}">
				                    		${orderTotal}
				                    	</c:if>
                                        </b>
                                    </span>
                                </div>
                                <c:if test="${isBand}">
                                    <div class="info-div" style="font-size:20px;display:inline">
                                        <span>&nbsp;&nbsp;&nbsp;总可提现金额： </span>
                                        <span><b class="active-red">
                                        <c:if test="${totalAleAmount > 0}">
                                            <fmt:formatNumber pattern="#,###.##" value="${totalAleAmount}"/>
                                        </c:if>
				                    	<c:if test="${totalAleAmount == 0.0}">
                                            ${totalAleAmount}
                                        </c:if>
                                        </b>
                                    </span>
                                    </div>
                                    <div class="info-div" style="font-size:20px;display:inline">
                                        <span>&nbsp;&nbsp;&nbsp;已提现金额： </span>
                                        <span><b class="active-red">
                                        <c:if test="${edWithdrawalsAmount > 0}">
                                            <fmt:formatNumber pattern="#,###.##" value="${edWithdrawalsAmount}"/>
                                        </c:if>
				                    	<c:if test="${edWithdrawalsAmount == 0.0}">
                                            ${edWithdrawalsAmount}
                                        </c:if>
                                        </b>
                                    </span>
                                    </div>
                                    <div class="info-div" style="font-size:20px;display:inline">
                                        <span>&nbsp;&nbsp;&nbsp;当前可提现金额： </span>
                                        <span><b class="active-red">
                                        <c:if test="${ingWithdrawalsAmount > 0}">
                                            <fmt:formatNumber pattern="#,###.##" value="${ingWithdrawalsAmount}"/>
                                        </c:if>
				                    	<c:if test="${ingWithdrawalsAmount == 0.0}">
                                            ${ingWithdrawalsAmount}
                                        </c:if>
                                        </b>
                                    </span>
                                    </div>
                                </c:if>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <form class="layui-form" action="${ctx}/moneyManagement/crowdFundingMoneyList.do" id="myForm"
                              method="post">
                            <div class="f-search-bar">
                                <div class="search-container">
                                    <ul class="search-form-content">
                                        <li class="form-item"><label class="search-form-lable"></label>
                                            <div class="check-btn-inner">
                                                <a id="all" class="active" href="javascript:void(0);"
                                                   >收益记录</a>
                                            </div>
                                        </li>
                                        <li class="form-item-inline">
                                            <div class="sub-btns">
                                                <span><a href="javascript:billingInstructions('${memberPartner.partnerType}','${withdrawalCharge}')" class="red">结算说明</a> </span>
                                            </div>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <input type="hidden" name="pageNo" id="pageNo"/>
                        </form>
                        <div class="my-act-list-content">
                            <div class="cl">
                                    <table class="layui-table">
                                        <colgroup>
                                            <col width="75">
                                            <col width="10%">
                                            <c:if test="${memberPartner.partnerType==0}">
                                                <col width="90">
                                            </c:if>
                                            <col width="115">
                                            <col width="75">
                                            <col width="100">
                                            <c:if test="${memberPartner.partnerType==0}">
                                            <col width="105">
                                            </c:if>
                                            <col width="105">
                                            <col width="80">
                                            <c:if test="${isBand}">
                                            <col width="105">
                                            <col width="100">
                                            <col width="110">
                                            <col width="90">
                                            </c:if>
                                        </colgroup>
                                        <thead>
                                        <tr>
                                            <th>排列号</th>
                                            <th>主题名称</th>
                                            <c:if test="${memberPartner.partnerType==0}">
                                                <th>活动类型</th>
                                            </c:if>
                                            <th>发布时间</th>
                                            <th>状态</th>
                                            <th>提现成功人数</th>
                                            <c:if test="${memberPartner.partnerType==0}">
                                              <th>担保金(每人)</th>
                                            </c:if>
                                            <th>活动金额（每人）</th>
                                            <th>累计资金</th>
                                            <c:if test="${isBand}">
                                            <th>总可提现金额</th>
                                            <th>已提现金额</th>
                                            <th>当前可提现金额</th>
                                            <th>操作</th>
                                            </c:if>
                                        </tr>
                                        </thead>
                                        <tbody>

                                        <c:set var="nowDate" value="<%=new Date()%>"></c:set>
                                        <c:forEach var="cewo" items="${cewoLists}" varStatus="st">
                                            <tr>
                                                <td>
                                                    <c:set var="rowNo" value="${st.count + ((page.page - 1) * page.limit)}"/>
                                                    <c:if test="${rowNo < 10}">0${rowNo}</c:if>
                                                    <c:if test="${rowNo >= 10}">${rowNo}</c:if>
                                                </td>
                                                <td>${cewo.name}</td>
                                                <c:if test="${memberPartner.partnerType==0}">
                                                    <td>
                                                        <c:if test="${cewo.eventType == 0}">普通活动</c:if>
                                                        <c:if test="${cewo.eventType == 1}">高端活动</c:if>
                                                    </td>
                                                </c:if>
                                                <td><c:if test="${not empty cewo.createDate}"><fmt:formatDate
                                                        value="${cewo.createDate}"
                                                        pattern="yyyy-MM-dd HH:mm"/></c:if></td>

                                                <td>
                                                    <c:if test="${cewo.endTime > nowDate}">
                                                        <span class="red">进行中</span>
                                                    </c:if>
                                                    <c:if test="${cewo.endTime < nowDate}">
                                                        <span>已截止</span>
                                                    </c:if>
                                                </td>
                                                <td>${cewo.successNum}</td>
                                                <c:if test="${memberPartner.partnerType==0}">
                                                    <td>
                                                        <c:if test="${cewo.serviceCharge ==null}">
                                                            0.00元
                                                        </c:if>
                                                        <c:if test="${cewo.serviceCharge !=null}">
                                                            <fmt:formatNumber pattern="0.00"
                                                                              value="${cewo.serviceCharge}"/>元
                                                        </c:if>
                                                    </td>
                                                </c:if>
                                                <td><fmt:formatNumber pattern="0.00"
                                                                      value="${cewo.price}"/>元
                                                </td>
                                                <td><fmt:formatNumber pattern="0.00"
                                                                      value="${cewo.orderTotal}"/>元
                                                </td>
                                                <c:if test="${isBand}">
                                                    <td><fmt:formatNumber pattern="0.00"
                                                                          value="${cewo.totalAleAmount}"/>元
                                                    </td>
                                                    <td><fmt:formatNumber pattern="0.00"
                                                                          value="${cewo.edWithdrawalsAmount}"/>元
                                                    </td>
                                                    <td><fmt:formatNumber pattern="0.00"
                                                                          value="${cewo.ingWithdrawalsAmount}"/>元
                                                    </td>
                                                    <td>
                                                        <a href="${ctx}/moneyManagement/withdrawalInfo.do?eventId=${cewo.id}"
                                                           target="_self" class="green">查看提现</a>
                                                    </td>
                                                </c:if>
                                            </tr>
                                        </c:forEach>
                                        </tbody>
                                    </table>
                            </div>
                        </div>
                        <div class="page-content">
                            <div id="page_content" class="page-container"></div>
                        </div>
                    </div>
                    <div class="layui-tab-item"></div>
                    <div class="layui-tab-item"></div>
                </div>
            </div>
        </div><!--底部-->
        <%@include file="../include/footer.jsp" %>
    </section>
    <div id="authorDialog1">
        <table class="layui-table" lay-skin="line">
            <tbody>
            <tr>
                <td class="table-member">
                    <div class="member-cell">
                        <div class="member-name ellipsis-1">
                            <div class="cl">
                                <p>注：</p>
                                <dl id="dl_id" style="line-height: 30px;">
                                    <dt>提现成功人数：截止至上周日24:00的众筹成功人数；</dt>
                                    <dt>累计资金：截止当前时间众筹的累计资金；（实时统计）</dt>
                                    <dt>总可提现金额：截止至上周日24:00的可提现金额；</dt>
                                    <dt>总可提现金额 =（活动金额—<span id="fwffont_id"></span>）x提现成功人数；</dt>
                                    <dt>已提现金额：包含已提交申请待审核的金额；</dt>
                                    <dt>当前可提现金额 = 总可提现金额—已提现金额；</dt>
                                </dl>
                            </div>
                        </div>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
</div>

<script type="text/javascript" src="${ctx}/script/common/list.js"></script>
<script type="text/javascript">
    $(function () {
        txz.initHeader({
            nav: [{
                name: '资金管理',
                curr: true
            }]
        });


        layui.use([ 'element' ], function() {
            var element = layui.element;

            element.on('tab', function (data) {
                if (data.index == 0) {
                    location.href = "${ctx}/moneyManagement/allMoneyList.do";
                } else if(data.index == 1){
                    location.href = "${ctx}/moneyManagement/crowdFundingMoneyList.do";
                }
            });
        });

        //加载分页
        loadPageNew({
            elem: 'page_content',
            totalCount: '${page.totalCount}',
            limit: '${page.limit}',
            page: '${page.page}'
        });
    })

    function billingInstructions(partnerType,withdrawalCharge) {

        ('${memberPartner.partnerType}','${withdrawalCharge}')
        var setPayIndex = layer.open({
            type: 1,
            area: '400px',
            title: '结算说明',
            content: $("#authorDialog1"),
            btn: ['关闭'],
            success: function () { // 弹出后回调
                if(partnerType==0&&withdrawalCharge!=null&&withdrawalCharge>0){
                    $("#dl_id").append("<dt id='sdt_id'>平台手续费："+withdrawalCharge+"%</dt>")
                    $("#fwffont_id").text("担保金");
                }else{
                    $("#fwffont_id").text("服务费");
                }

            },
            yes: function () { // 确定按钮
                if($("#sdt_id").length>0){
                    $("#sdt_id").remove()
                }
                layer.close(setPayIndex);
            },
            end: function () {//取消按钮
                if($("#sdt_id").length>0){
                    $("#sdt_id").remove()
                }
                layer.close(setPayIndex);
            }
        });
    }
</script>
</body>
</html>